﻿CREATE PROCEDURE [acms].[Post_GetBySiteUrlAndPostUrl]
	@SiteUrl varchar(50), 
	@PostUrl varchar(255)
AS
	declare @SiteId int
	select @SiteId = Id From Site_View where Root = @SiteUrl
	
	if(@SiteId is null)
		select @SiteId = SiteId From SiteMappings where MappingName = @SiteUrl
	
	SELECT *
	From Post_View
	Where
		SiteId = @SiteId
		and isNull(ParentPath, '') + Name = @PostUrl

RETURN 0;